/*
 * @Author: 黄达全
 * @Date: 2024-08-04 14:19:56
 * @LastEditTime: 2024-08-10 14:37:49
 */
import { ApiResponse } from "./http"
import type { UploadFile, UploadFiles } from "element-plus"

export type ImageApi = {
    add: (form: ImageInsertForm) => Promise<ApiResponse<ImageInsertVO>>,
    page: (page: number, pageSize: number) => Promise<ApiResponse<ImageClassPageVO>>,
    select:()=> Promise<ApiResponse<ImageClassEntity[]>>,
    addImageByCategory:(requestbody:ImageUploadByCategoryRequestBody[],imageClassId:number) => Promise<ApiResponse<null>>,
    update:(form: ImageClassUpdateForm) => Promise<ApiResponse<null>>,
    getImageByCategoryByPage:(id:number,page: number, pageSize: number) => Promise<ApiResponse<ImagePageVO>>,
    delete:(id:number) => Promise<ApiResponse<null>>,
    deleteImage(id:number,filename:string): Promise<ApiResponse<null>>,
    editImage:(form: ImageUpdateForm)=> Promise<ApiResponse<null>>
}

export type ImageClassEntity = {
    id: number,
    name: string,
    order: number
}

// 插入
export type ImageInsertForm = {
    name: string,
    order: number
}
export type ImageInsertVO = ImageClassEntity

// 编辑
export type ImageClassUpdateForm = {
    id:number,
    name: string,
    order: number
}

// 图片分类的分页
export type ImageClassPageVO = {
    total: number
    records: ImageInsertVO[]
}

// 上传图片
export type ImageUploadResponse = {
    response: any,
    uploadFile: UploadFile,
    uploadFiles: UploadFiles
} 

// 选择分类
export type ElSelectCategoryList = {
    label:string,
    value:number
}

export type UploadImageVO= {
    name:string,
    url:string
}

export type ImageUploadByCategoryRequestBody= {
    name:string,
    url:string,
}

// 图片的分页
export type ImagePageVO = {
    total: number
    records: ImagePageItem[]
}
export type ImagePageItem = {
        id:number,
        name:string,
        path:string,
        url:string,
        imageClassId:number
}
export type ImageUpdateForm = {
        name:string,
        id:number
}